package com.hyyt.shopjsp.wxmg.publicNo.controller;

import com.hyyt.shopjsp.common.controller.BaseController;
import com.hyyt.shopjsp.util.common.ResultMsg;
import com.hyyt.shopjsp.util.json.FastJsonUtils;
import com.hyyt.shopjsp.wxmg.publicNo.service.IWxPublicNoInfoService;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.Map;

/**
 * 微信基本信息Controller
 *
 * @author
 *
 */
@Controller
@RequestMapping("/back/wx/publicNo")
public class WxPublicNoInfoController extends BaseController {

	private Logger logger = Logger.getLogger(WxPublicNoInfoController.class);
	private String basePath = "/back/wxmg/common/";

    /**
     * 微信基础信息service
     */
    @Resource
    private IWxPublicNoInfoService wxPublicNoInfoService;

    /**
     * 更新微信 accessToken
     */
    @RequestMapping("wxPublicNoInfoAccessTokenUpdate")
    @ResponseBody
    public ResultMsg wxPublicNoInfoAccessTokenUpdate() {
        Map<String,Object> returnMap = wxPublicNoInfoService.wxPublicNoInfoAccessTokenUpdate();
        Boolean flag = (Boolean) returnMap.get("flag");
        String ticket = String.valueOf(returnMap.get("ticket"));
        ticket = "微信令牌定时加载ticket：" + ticket;
        return ResultMsg.create(flag,ticket,FastJsonUtils.toJSONString(returnMap));
    }

}
